package saas.adapter.sdk.api;

import com.alibaba.fastjson.JSON;
import com.baozun.ecs.oms4.tenant.perception.core.injector.TenantConversionInjector;
import com.baozun.ecs.oms4.tenant.perception.core.provider.TenantConversionRelationHolder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author guan.xin
 * @title ApiController
 * @description
 * @create 2022-05-25 21:00
 * @since JDK8
 */
@Slf4j
@RestController
@RequestMapping(value = "/api")
public class ApiController {

    @GetMapping(value = "/test")
    public void test() {
        TenantConversionInjector.setTenantContextByInnerStoreCode("SaaS001owner", true);
        TenantConversionInjector.setTenantContextByStoreCode("SaaS001", true);

        log.info(JSON.toJSONString(TenantConversionRelationHolder.TENANT_CONVERSION_RELATION_BY_INNER_STORE_CODE.get()));
        log.info(JSON.toJSONString(TenantConversionRelationHolder.TENANT_CONVERSION_RELATION_BY_STORE_CODE.get()));
    }
}
